package com.spring.context.support;

import com.spring.beans.BeansException;
import com.spring.beans.factory.config.BeanDefinition;
import com.spring.beans.factory.support.BeanDefinitionReader;
import com.spring.beans.factory.support.DefaultListableBeanFactory;
import com.spring.beans.factory.xml.XmlBeanDefinitionReader;

/**
 * @Description: This is a sample class.
 * @Author: Simon
 */
public abstract class AbstractXmlApplicationContext extends AbstractRefreshableApplicationContext {

    protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) throws BeansException {
        XmlBeanDefinitionReader xmlBeanDefinitionReader = new XmlBeanDefinitionReader(beanFactory, this);
        String[] configurations = getConfigLocations();
        if (configurations != null) {
            xmlBeanDefinitionReader.loadBeanDefinitions(configurations);
        }
    }

    protected abstract String[] getConfigLocations();
}
